#include <stdio.h>
int main() 
{
	
	freopen("zz_test\\test3.in", "r", stdin);
	freopen("zz_test\\test3.out", "w", stdout);
	int a = 0, b = 0, c = 0, d = 0;
	scanf("%d %d %d %d", &a, &b, &c, &d);
	int begin = a*60 + b;
	int end = c * 60 + d;
	int t = end - begin;
	printf("%d %d", t/60, t%60);
	return 0;
}
